package com.a0soft.gphone.aTruffleHog.util;
/*
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 3, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * Copyright(C) 2011 
 *   Sam Lu <ysl.sam.lu (at) gmail.com>
 *
 */

import java.io.File;
import java.util.List;

import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.hardware.Camera;

public class SDK8 {
	private static SDK8	m_inst;
	
	private SDK8() {}
	
	public static SDK8
	GetInstance()
	{
		if (m_inst == null)
			m_inst = new SDK8();
		return m_inst;
	}
	
	public File 
    GetExternalFilesDir(Context ctx, String strType)
    {
        return ctx.getExternalFilesDir(strType);
    }
	
    public List<Camera.Size>
    CameraParameters_GetSupportedJpegThumbnailSizes(Camera.Parameters params)
    {
        return params.getSupportedJpegThumbnailSizes();
    }
    
    public boolean
    CameraParameters_IsSmoothZoomSupported(Camera.Parameters params)
    {
        return params.isSmoothZoomSupported();
    }
    
    public boolean
    CameraParameters_IsZoomSupported(Camera.Parameters params)
    {
        return params.isZoomSupported();
    }
    
    public boolean
    IsAppInstalledOnExternalStorage(Context ctx, String strPkgName)
    {
        PackageManager pm = ctx.getPackageManager();
        try {
            ApplicationInfo ai;
            ai = pm.getApplicationInfo(strPkgName, 0);
            return ((ai.flags & ApplicationInfo.FLAG_EXTERNAL_STORAGE) != 0);
        }
        catch (NameNotFoundException e) {
        }
        return false;
    }
}